interface User {
  age: number;
  name: string;
}

// 可选
let u: Partial<User> = {
  age: 123,
};

// 必选
let u1: Required<User> = {
  age: 123,
  name: "zs",
};

// 只读
let u2: Readonly<User> = {
  age: 123,
  name: "ls",
};
// u2.age = 1223

// 参数1中剔除到参数2中类型
let u3: Exclude<"a" | "b" | "c", "b" | "d" | "c"> = "a";

type T = "男" | "女" | null | undefined;
type NEWT = Exclude<T, null | undefined>;

// 参数1中选择参数2中相同的类型
type u4 = Extract<"a" | "b" | "c" | "d", "b" | "c" | "e" | "f">;

// 剔除null，undefined类型
type T1 = NonNullable<T>;

type func = () => number;
// 获取当前函数的返回值类型
type returnType = ReturnType<func>;

function sum(a: number, b: number) {}

let a: ReturnType<typeof sum>;

class UserCls {}

let u11: InstanceType<typeof UserCls> = new UserCls();
